home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1997 January / macformat46.iso / Shareware Plus / Applications / Charting Coach / Charting Coach V2.0sw / Charting Coach V2.DXR / 00510.ls < prev    next >
Encoding:
Text File  |  1996-10-13  |  21.4 KB  |  685 lines

  1. on checkChanges
  2.   global advice, basis, stamp, dayNo, bioInfo, PeakDayNo, currentCycleNo, userNo, cycleNo, wantsToViewCycles, previousPeak
  3.   set advice to []
  4.   set basis to []
  5.   if checkLogic2() then
  6.     repeat with i = 1 to count(stamp)
  7.       set dayNo to i
  8.       if max(bioInfo) = 14 then
  9.         getConceiveAdvice()
  10.         next repeat
  11.       end if
  12.       getAbstainAdvice()
  13.     end repeat
  14.   else
  15.     beep(2)
  16.     go("monthly")
  17.     makeCorrection()
  18.     cursor(0)
  19.     exit
  20.   end if
  21.   killcorrection()
  22.   writecycleinfo()
  23.   puppetVisible(13, 48, 1)
  24.   puppetStatus(11, 48, 0)
  25.   if wantsToViewCycles = 0 then
  26.     if currentCycleNo <> getAt(cycleNo, userNo) then
  27.       set currentCycleNo to getAt(cycleNo, userNo)
  28.       readCycleInfo()
  29.     end if
  30.     go("removeimage")
  31.     prepfrontpage()
  32.   else
  33.     go("removeimage")
  34.     go("cycle list")
  35.     cursor(0)
  36.   end if
  37. end
  38.  
  39. on upToNow10 dayNum
  40.   repeat with i = 1 to dayNum
  41.     if getAt(stamp, i) = 10 then
  42.       return 1
  43.     end if
  44.   end repeat
  45.   return 0
  46. end
  47.  
  48. on resetpeak
  49.   global PeakDayNo, stamp, previousPeak
  50.   if getOne(stamp, 10) > 0 then
  51.     setAt(stamp, getOne(stamp, 10), 3)
  52.   end if
  53.   set previousPeak to PeakDayNo
  54.   set PeakDayNo to 0
  55. end
  56.  
  57. on probablyPeak
  58.   global dayNo
  59.   set x to dayNo + 1
  60.   if getOne(bioInfo, 13) > 0 then
  61.     put "You indicated in the Biographical Data that you have anovulatory cycles. " into field "noPeakreason"
  62.     return 0
  63.   end if
  64.   if getOne(bioInfo, 1) > 0 then
  65.     put "You indicated in the Biographical Data that you are Breastfeeding. " into field "noPeakreason"
  66.     return 0
  67.   end if
  68.   if getOne(bioInfo, 2) > 0 then
  69.     put "You indicated in the Biographical Data that you are Under Stress or Rigorous Exercise. " into field "noPeakreason"
  70.     return 0
  71.   end if
  72.   if getOne(bioInfo, 3) > 0 then
  73.     put "You indicated in the Biographical Data that you are On Medication. " into field "noPeakreason"
  74.     return 0
  75.   end if
  76.   if getOne(bioInfo, 4) > 0 then
  77.     put "You indicated in the Biographical Data that you are In Estrogen Therapy. " into field "noPeakreason"
  78.     return 0
  79.   end if
  80.   if getOne(bioInfo, 5) > 0 then
  81.     put "You indicated in the Biographical Data that you are PeriMenopausal. " into field "noPeakreason"
  82.     return 0
  83.   end if
  84.   if getOne(bioInfo, 6) > 0 then
  85.     put "You indicated in the Biographical Data that you are Vegetarian. " into field "noPeakreason"
  86.     return 0
  87.   end if
  88.   if getOne(bioInfo, 7) > 0 then
  89.     put "You indicated in the Biographical Data that you are Over or Under Weight. " into field "noPeakreason"
  90.     return 0
  91.   end if
  92.   if getOne(bioInfo, 8) > 0 then
  93.     put "You indicated in the Biographical Data that you are Taking or Recently off of Hormonal Contraceptives. " into field "noPeakreason"
  94.     return 0
  95.   end if
  96.   if x < 6 then
  97.     put "You have not charted a sufficient number of days in the Charting Coach. " into field "noPeakreason"
  98.     return 0
  99.   else
  100.     if onlysensation(x) then
  101.       put "In this progression of mucus, you have not witnessed any wet or stretchy mucus." into field "noPeakreason"
  102.     end if
  103.     put "The mucus pattern you have charted is unusual. " into field "noPeakreason"
  104.     if (getAt(mucus, x) > 1) and (getAt(mucus, x) < 7) then
  105.       return 0
  106.     end if
  107.     if not ((getAt(mucus, x - 1) > 1) and (getAt(mucus, x - 1) < 7)) then
  108.       return 0
  109.     end if
  110.     if not ((getAt(mucus, x - 2) > 1) and (getAt(mucus, x - 2) < 7)) then
  111.       return 0
  112.     end if
  113.     if not ((getAt(mucus, x - 3) > 1) and (getAt(mucus, x - 3) < 7)) then
  114.       return 0
  115.     end if
  116.     set score to 0
  117.     repeat with i = x - 4 to x - 1
  118.       if (getAt(mucus, i) > 1) and (getAt(mucus, i) < 7) then
  119.         set score to score + getAt(mucus, i)
  120.       end if
  121.     end repeat
  122.     if score < 12 then
  123.       return 0
  124.     end if
  125.   end if
  126.   return 1
  127. end
  128.  
  129. on onlysensation x
  130.   if getAt(mucus, x) = 2 then
  131.     repeat with i = x down to 1
  132.       if getAt(mucus, x) = 0 then
  133.         return 1
  134.       end if
  135.       if (getAt(mucus, x) > 2) and (getAt(mucus, x) < 7) then
  136.         return 0
  137.       end if
  138.     end repeat
  139.   else
  140.     return 0
  141.   end if
  142.   return 1
  143. end
  144.  
  145. on resetAdvice
  146.   global advice, basis, dayNo, stamp, PeakDayNo, previousPeak, forewarned
  147.   set advice to []
  148.   set basis to []
  149.   set forewarned to 0
  150.   repeat with i = 1 to count(stamp)
  151.     set dayNo to i
  152.     if max(bioInfo) = 14 then
  153.       getConceiveAdvice()
  154.       next repeat
  155.     end if
  156.     getAbstainAdvice()
  157.   end repeat
  158. end
  159.  
  160. on getOnlyRedPrevious
  161.   global stamp, dayNo
  162.   if dayNo < 1 then
  163.     return 1
  164.   end if
  165.   if getAt(stamp, 1) > 1 then
  166.     return 0
  167.   end if
  168.   repeat with i = 1 to dayNo - 1
  169.     if getAt(stamp, i) > 2 then
  170.       return 0
  171.     end if
  172.   end repeat
  173.   set countbrown to 0
  174.   repeat with i = 1 to dayNo - 1
  175.     if getAt(stamp, i) = 2 then
  176.       set countbrown to countbrown + 1
  177.       if countbrown > 1 then
  178.         return 0
  179.       end if
  180.       next repeat
  181.     end if
  182.     set countbrown to 0
  183.   end repeat
  184.   return 1
  185. end
  186.  
  187. on getOnlyRedPrevious2 dayNum
  188.   if dayNum < 1 then
  189.     return 1
  190.   end if
  191.   repeat with i = 1 to dayNum
  192.     if getAt(stamp, i) > 2 then
  193.       return 0
  194.     end if
  195.   end repeat
  196.   set countbrown to 0
  197.   repeat with i = 1 to dayNum
  198.     if getAt(stamp, i) = 2 then
  199.       set countbrown to countbrown + 1
  200.       if countbrown > 2 then
  201.         return 0
  202.       end if
  203.       next repeat
  204.     end if
  205.     set countbrown to 0
  206.   end repeat
  207.   return 1
  208. end
  209.  
  210. on getAnovulatory
  211.   global stamp, previousPeak
  212.   if (getOne(stamp, 10) > 0) or (previousPeak > 0) then
  213.     killAnovul()
  214.     return 0
  215.   else
  216.     set x to getOne(stamp, 3)
  217.     if x > 0 then
  218.       set countFromWhite to x
  219.     else
  220.       set countFromWhite to 1
  221.     end if
  222.     repeat with i = countFromWhite to count(stamp)
  223.       if getAt(stamp, i) = 6 then
  224.         setAnovul()
  225.         return 1
  226.       end if
  227.     end repeat
  228.   end if
  229.   if getOne(bioInfo, 13) > 0 then
  230.     return 1
  231.   else
  232.     return 0
  233.   end if
  234. end
  235.  
  236. on killAnovul
  237.   global bioInfo
  238.   if getOne(bioInfo, 13) > 0 then
  239.     deleteAt(bioInfo, getOne(bioInfo, 13))
  240.   end if
  241. end
  242.  
  243. on setAnovul
  244.   global bioInfo
  245.   if getOne(bioInfo, 13) = 0 then
  246.     append(bioInfo, 13)
  247.   end if
  248.   if getOne(bioInfo, 9) > 0 then
  249.     deleteAt(bioInfo, getOne(bioInfo, 9))
  250.   end if
  251.   if getOne(bioInfo, 10) > 0 then
  252.     deleteAt(bioInfo, getOne(bioInfo, 10))
  253.   end if
  254.   if getOne(bioInfo, 11) > 0 then
  255.     deleteAt(bioInfo, getOne(bioInfo, 11))
  256.   end if
  257. end
  258.  
  259. on start3YellowBabies
  260.   global PeakDayNo, previousPeak
  261.   set dayNum to count(stamp)
  262.   if (getAt(stamp, 1) = 4) and (PeakDayNo = 0) and (previousPeak = 0) then
  263.     return 1
  264.   end if
  265.   return 0
  266. end
  267.  
  268. on inspectbasis basisNo, adviceno
  269.   set goodbasisList to [0, 101, 102, 103, 105, 106, 107, 108, 109, 111, 112, 113, 115, 117, 118, 119, 130, 131, 150, 201, 202, 203, 205, 206, 207, 208, 209, 210, 211, 215, 217, 218, 219, 125, 225, 126, 226]
  270.   set goodadvicelist to [0, 101, 102, 103, 104, 105, 107, 108, 109, 110, 150, 202, 250, 1000, 1101, 1102, 1103, 1104, 1105, 1107, 1108, 1109, 1110, 1150, 1202, 1250]
  271.   if getOne(goodbasisList, basisNo) and getOne(goodadvicelist, adviceno) then
  272.     return 1
  273.   else
  274.     return 0
  275.   end if
  276. end
  277.  
  278. on violatedRule
  279.   global relations, advice, dayNo
  280.   set dayNum to dayNo
  281.   if dayNum < 2 then
  282.     return 0
  283.   end if
  284.   if (getAt(relations, dayNum - 1) <> 4) and (getAt(relations, dayNum - 1) <> 0) then
  285.     set lookadvice to getAt(advice, dayNum - 1)
  286.     if lookadvice > 1000 then
  287.       set lookadvice to lookadvice - 1000
  288.     end if
  289.     if (lookadvice = 101) or (lookadvice = 104) or ((lookadvice > 106) and (lookadvice < 110)) then
  290.       return 1
  291.     else
  292.       if (lookadvice = 102) and (getAt(relations, dayNum - 1) <> 2) then
  293.         return 1
  294.       else
  295.         return 0
  296.       end if
  297.     end if
  298.   else
  299.     return 0
  300.   end if
  301. end
  302.  
  303. on alertviolatedRule
  304.   global relations, advice, dayNo
  305.   set dayNum to dayNo
  306.   if dayNum < 1 then
  307.     return 0
  308.   end if
  309.   if getAt(relations, dayNum) <> 4 then
  310.     set lookadvice to getAt(advice, dayNum)
  311.     if lookadvice > 1000 then
  312.       set lookadvice to lookadvice - 1000
  313.     end if
  314.     if (lookadvice = 101) or (lookadvice = 104) or ((lookadvice > 106) and (lookadvice < 110)) then
  315.       return 1
  316.     else
  317.       if (lookadvice = 102) and (getAt(relations, dayNum) <> 2) then
  318.         return 1
  319.       else
  320.         return 0
  321.       end if
  322.     end if
  323.   else
  324.     return 0
  325.   end if
  326. end
  327.  
  328. on anyFertileDay
  329.   global mucus
  330.   set last to count(mucus)
  331.   repeat with i = 1 to last
  332.     if (getAt(mucus, i) < 7) and (getAt(mucus, i) > 1) then
  333.       return 1
  334.     end if
  335.   end repeat
  336. end
  337.  
  338. on checkLogicRed
  339.   global stamp, mucus, PeakDayNo
  340.   set dayNum to count(stamp)
  341.   if (getOnlyRedPrevious() = 0) and ((dayNum - PeakDayNo) > 9) then
  342.     cursor(0)
  343.     go("StartNewCycle")
  344.     cursor(0)
  345.   else
  346.     append(relations, 0)
  347.     append(stamp, 1)
  348.     append(mucus, 0)
  349.     resetpeak()
  350.     showDays()
  351.     setupDayBook()
  352.     cursor(0)
  353.   end if
  354. end
  355.  
  356. on checkLogicBrown
  357.   global stamp, mucus, PeakDayNo, previousPeak
  358.   set dayNum to count(stamp)
  359.   if dayNum > 0 then
  360.     if ((PeakDayNo > 0) and ((dayNum - PeakDayNo) < 3)) or ((previousPeak > 0) and ((dayNum - previousPeak) < 3)) or (getAt(stamp, dayNum) = 3) then
  361.       cursor(0)
  362.       set the visible of sprite 16 to 0
  363.       alert("If dry within three days after the presence of mucus or spotting, choose the Brown Baby Stamp.")
  364.       set the visible of sprite 16 to 1
  365.     else
  366.       append(relations, 0)
  367.       append(mucus, 0)
  368.       append(stamp, 2)
  369.       setupDayBook()
  370.       showDays()
  371.       cursor(0)
  372.     end if
  373.   else
  374.     append(relations, 0)
  375.     append(mucus, 0)
  376.     append(stamp, 2)
  377.     setupDayBook()
  378.     showDays()
  379.     cursor(0)
  380.   end if
  381. end
  382.  
  383. on checkLogicWhite
  384.   global PeakDayNo, stamp, forewarned, candidateStamp
  385.   if forewarned = 1 then
  386.     cursor(0)
  387.     alert("The Previous Peak will be removed.")
  388.     cursor(4)
  389.     set forewarned to 0
  390.     resetpeak()
  391.     set candidateStamp to 3
  392.     go("chart mucus")
  393.     cursor(0)
  394.   else
  395.     if getOne(stamp, 10) > 0 then
  396.       cursor(0)
  397.       if max(mucus) > 0 then
  398.         set forewarned to 1
  399.         set the visible of sprite 16 to 0
  400.         alert("     You have chosen the White Baby stamp but Peak Day was identified previously." & RETURN & "     If you have a milky white mucus, choose the Yellow Stamp. If you have a moist or lubricated sensation or a clear, stretchy mucus, choose the White Baby stamp again.")
  401.         set the visible of sprite 16 to 1
  402.       else
  403.         set candidateStamp to 3
  404.         go("chart mucus")
  405.         cursor(0)
  406.         set PeakDayNo to 0
  407.       end if
  408.     else
  409.       if PeakDayNo > 0 then
  410.         set PeakDayNo to 0
  411.       end if
  412.       set candidateStamp to 3
  413.       go("chart mucus")
  414.       cursor(0)
  415.     end if
  416.   end if
  417. end
  418.  
  419. on checklogicYellowBaby
  420.   global PeakDayNo, stamp, candidateStamp, mucus
  421.   set dayNum to count(stamp)
  422.   if dayNum > 0 then
  423.     if ((PeakDayNo > 0) and ((count(stamp) - PeakDayNo) > 2)) or ((PeakDayNo > 0) and ((count(stamp) - PeakDayNo) < 4) and ((PeakDayNo - getOne(stamp, 10)) > 3) and (getAt(stamp, count(stamp)) <> 3) and (getOne(stamp, 10) > 0)) or ThreeBabies() then
  424.       cursor(0)
  425.       set the visible of sprite 16 to 0
  426.       alert("The Yellow Baby stamp should only be chosen for the three days after Peak Day. ")
  427.       set the visible of sprite 16 to 1
  428.     else
  429.       if (getAt(mucus, dayNum) < 7) and (getAt(mucus, dayNum) > 1) then
  430.         set candidateStamp to 4
  431.         go("askSensation")
  432.         cursor(0)
  433.       else
  434.         if (getAt(stamp, count(stamp)) = 2) or (getAt(stamp, count(stamp)) = 6) or getOnlyRedPrevious() or (not SomethingFertile() and (dayNum > 3)) then
  435.           cursor(0)
  436.           set the visible of sprite 16 to 0
  437.           alert("The Yellow Baby stamp should only be chosen for the three days after Peak Day.  At the onset of mucus, choose the White Baby Stamp.")
  438.           set the visible of sprite 16 to 1
  439.         else
  440.           set candidateStamp to 4
  441.           go("chart mucus")
  442.           cursor(0)
  443.         end if
  444.       end if
  445.     end if
  446.   else
  447.     cursor(0)
  448.     set the visible of sprite 16 to 0
  449.     alert("Sorry.  The Yellow Stamp Cannot Be Charted The First Day.")
  450.     set the visible of sprite 16 to 1
  451.   end if
  452. end
  453.  
  454. on ThreeBabies
  455.   set x to 0
  456.   set dayNum to count(stamp)
  457.   if dayNum < 3 then
  458.     return 0
  459.   end if
  460.   repeat with i = 0 to 2
  461.     if (getAt(stamp, dayNum - i) = 4) or (getAt(stamp, dayNum - i) = 5) or (getAt(stamp, dayNum - i) = 0) then
  462.       set x to x + 1
  463.       next repeat
  464.     end if
  465.     set x to 0
  466.   end repeat
  467.   if x > 2 then
  468.     return 1
  469.   else
  470.     return 0
  471.   end if
  472. end
  473.  
  474. on SomethingFertile
  475.   repeat with dayNum = 1 to count(stamp)
  476.     if (getAt(mucus, dayNum) < 7) and (getAt(mucus, dayNum) > 1) then
  477.       return 1
  478.     end if
  479.   end repeat
  480.   return 0
  481. end
  482.  
  483. on checkLogicBrownBaby
  484.   global PeakDayNo, stamp, candidateStamp, mucus
  485.   set dayNum to count(stamp)
  486.   if dayNum > 0 then
  487.     if ((getOne(stamp, 10) > 0) and ((dayNum - getOne(stamp, 10)) > 3)) or ThreeBabies() then
  488.       cursor(0)
  489.       set the visible of sprite 16 to 0
  490.       alert("The brown baby stamp should only be chosen for the three days after the presence of mucus or spotting.  When dry at other times use the brown stamp.")
  491.       set the visible of sprite 16 to 1
  492.     else
  493.       if (getAt(mucus, dayNum) < 7) and (getAt(mucus, dayNum) > 1) then
  494.         set candidateStamp to 5
  495.         go("askSensation")
  496.         cursor(0)
  497.       else
  498.         if (getAt(stamp, count(stamp)) = 2) or (getAt(stamp, count(stamp)) = 6) then
  499.           cursor(0)
  500.           set the visible of sprite 16 to 0
  501.           alert("The brown baby stamp should only be chosen for the three days after the presence of mucus or spotting.  When dry at other times use the brown stamp.")
  502.           set the visible of sprite 16 to 1
  503.         else
  504.           append(relations, 0)
  505.           append(mucus, 0)
  506.           append(stamp, 5)
  507.           showDays()
  508.           setupDayBook()
  509.         end if
  510.       end if
  511.       cursor(0)
  512.     end if
  513.   else
  514.     append(relations, 0)
  515.     append(mucus, 0)
  516.     append(stamp, 5)
  517.     showDays()
  518.     setupDayBook()
  519.   end if
  520. end
  521.  
  522. on checkLogicYellow
  523.   global stamp, mucus, PeakDayNo, candidateStamp, warnYellow, previousPeak
  524.   if count(stamp) = 0 then
  525.     if warnYellow = 1 then
  526.       set warnYellow to 0
  527.       set candidateStamp to 6
  528.       go("chart mucus")
  529.       cursor(0)
  530.       exit
  531.     else
  532.       set warnYellow to 1
  533.       cursor(0)
  534.       set the visible of sprite 16 to 0
  535.       alert("You may select the Yellow Stamp only if you've had two weeks of unchanging mucus. " & RETURN & RETURN & "If you've had two weeks of unchanging mucus, select the Yellow Stamp again.")
  536.       set the visible of sprite 16 to 1
  537.       exit
  538.     end if
  539.   end if
  540.   if getOne(stamp, 10) > 0 then
  541.     if (count(stamp) - PeakDayNo) < 3 then
  542.       cursor(0)
  543.       set the visible of sprite 16 to 0
  544.       alert("For the three days after Peak Day or Spotting, choose a Baby Stamp.")
  545.       set the visible of sprite 16 to 1
  546.     else
  547.       set candidateStamp to 6
  548.       go("chart mucus")
  549.       cursor(0)
  550.     end if
  551.   else
  552.     if ((PeakDayNo > 0) and ((count(stamp) - PeakDayNo) < 3)) or ((previousPeak > 0) and ((count(stamp) - previousPeak) < 3)) then
  553.       cursor(0)
  554.       set the visible of sprite 16 to 0
  555.       alert("For the three days after Peak type mucus or spotting, choose a Baby Stamp.")
  556.       set the visible of sprite 16 to 1
  557.     else
  558.       if getAnovulatory() or warnYellow then
  559.         set warnYellow to 0
  560.         set candidateStamp to 6
  561.         go("chart mucus")
  562.         cursor(0)
  563.       else
  564.         set warnYellow to 1
  565.         cursor(0)
  566.         set the visible of sprite 16 to 0
  567.         alert("You may select the Yellow Stamp only if you've had two weeks of unchanging mucus. " & RETURN & RETURN & "If you've had two weeks of unchanging mucus, select the Yellow Stamp again.")
  568.         set the visible of sprite 16 to 1
  569.       end if
  570.     end if
  571.   end if
  572. end
  573.  
  574. on checkLogic2
  575.   global PeakDayNo
  576.   if getOne(stamp, 1) > 0 then
  577.     set first to getOne(stamp, 1)
  578.     repeat with i = first to count(stamp) - 1
  579.       if (getAt(stamp, i) = 1) and (i > 2) then
  580.         if (getAt(stamp, i - 1) <> 1) and (getAt(stamp, i - 2) <> 1) then
  581.           if getAt(stamp, i + 1) = 2 then
  582.             put "ERROR: " & "On Day # " & i + 1 & ", the Brown Stamp was used.  If dry within three days after spotting or bleeding, use the Brown Baby Stamp." into field "problem"
  583.             return 0
  584.             next repeat
  585.           end if
  586.           if getAt(stamp, i + 1) = 6 then
  587.             put "ERROR: " & "On Day # " & i + 1 & ", the Yellow Stamp was used.  If dry within three days after spotting or bleeding, use the Brown Baby Stamp." into field "problem"
  588.             return 0
  589.           end if
  590.         end if
  591.       end if
  592.     end repeat
  593.   end if
  594.   if (getOne(stamp, 3) > 0) or (getOne(stamp, 10) > 0) then
  595.     if getOne(stamp, 10) > 0 then
  596.       repeat with i = count(stamp) down to getOne(stamp, 10) + 1
  597.         if (getAt(mucus, i) < 7) and (getAt(mucus, i) > 1) then
  598.           put "ERROR: " & "On Day #" & i & ", there was stretchy, elastic mucus or a wet, slippery sensation.  If the mucus stamp is correct, Day #" & getOne(stamp, 10) & " could not be Peak Day.  If you would like to change it, click on it with the eraser." into field "problem"
  599.           return 0
  600.         end if
  601.         if getAt(stamp, i) = 1 then
  602.           put "ERROR: " & "On Day # " & i & ", there was spotting or bleeding.  If the red stamp is correct, Day #" & getOne(stamp, 10) & " could not be Peak Day.  You must use the eraser to change Day #" & i & " or Day #" & getOne(stamp, 10) into field "problem"
  603.           return 0
  604.         end if
  605.       end repeat
  606.     end if
  607.     repeat with i = 1 to count(stamp) - 1
  608.       if (getAt(mucus, i) < 7) and (getAt(mucus, i) > 1) and ((getAt(mucus, i + 1) > 7) or (getAt(mucus, i + 1) = 1)) and (getAt(stamp, i + 1) <> 4) then
  609.         put "ERROR: " & "On Day # " & i + 1 & ", there was a dramatic change in mucus.  The Yellow Baby Stamp should have been used unless there was a wet or lubricated sensation.  If there was a wet or lubricated sensation,  use the White Baby Stamp and the Sensation (raindrop) stamp." into field "problem"
  610.         return 0
  611.       end if
  612.       if (getAt(stamp, i) = 3) or (getAt(stamp, i) = 10) then
  613.         if getAt(stamp, i + 1) = 2 then
  614.           put "ERROR: " & "On Day # " & i + 1 & ", the Brown Stamp was used.  If dry within three days after the presence of mucus or spotting, use the Brown Baby Stamp." into field "problem"
  615.           return 0
  616.           next repeat
  617.         end if
  618.         if (getAt(stamp, i + 1) = 6) and (getAt(mucus, i) < 7) and (getAt(mucus, i) > 1) then
  619.           put "ERROR: " & "On Day # " & i + 1 & ", the Yellow Stamp was used.  Three days after the appearance of Peak Type mucus, use the Yellow Baby Stamp." into field "problem"
  620.           return 0
  621.           next repeat
  622.         end if
  623.         if (i + 2) < count(stamp) then
  624.           if getAt(stamp, i + 2) = 2 then
  625.             put "ERROR: " & "On Day # " & i + 2 & ", the Brown Stamp was used.  If dry within three days after the presence of mucus or spotting, use the Brown Baby Stamp." into field "problem"
  626.             return 0
  627.             next repeat
  628.           end if
  629.           if (getAt(stamp, i + 2) = 6) and (getAt(mucus, i) < 7) and (getAt(mucus, i) > 1) then
  630.             put "ERROR: " & "On Day # " & i + 1 & ", the Yellow Stamp was used.  Three days after the appearance of Peak Type mucus, use the Yellow Baby Stamp." into field "problem"
  631.             return 0
  632.             next repeat
  633.           end if
  634.           if (i + 3) < count(stamp) then
  635.             if getAt(stamp, i + 3) = 2 then
  636.               put "ERROR: " & "On Day # " & i + 3 & ", the Brown Stamp was used.  If dry within three days after the presence of mucus or spotting, use the Brown Baby Stamp." into field "problem"
  637.               return 0
  638.               next repeat
  639.             end if
  640.             if (getAt(stamp, i + 3) = 6) and (getAt(mucus, i) < 7) and (getAt(mucus, i) > 1) then
  641.               put "ERROR: " & "On Day # " & i + 1 & ", the Yellow Stamp was used.  Three days after the appearance of Peak Type mucus, use the Yellow Baby Stamp." into field "problem"
  642.               return 0
  643.             end if
  644.           end if
  645.         end if
  646.       end if
  647.     end repeat
  648.   end if
  649.   if (getOne(stamp, 4) > 0) or (getOne(stamp, 5) > 0) then
  650.     set x to 0
  651.     repeat with i = 1 to count(stamp)
  652.       if (getAt(stamp, i) = 4) or (getAt(stamp, i) = 5) then
  653.         if i > 1 then
  654.           if (getAt(stamp, i - 1) = 2) or (getAt(stamp, i - 1) = 6) then
  655.             if getAt(stamp, i) = 5 then
  656.               put "ERROR: " & "On Day # " & i & ", the Brown Baby Stamp was used.  Only use the Brown Baby Stamp the three days after the presence of mucus or spotting, at all other dry times use the Brown Stamp." into field "problem"
  657.               return 0
  658.             else
  659.               put "ERROR: " & "On Day # " & i & ", the Yellow Baby Stamp was used.  Only use the Yellow Baby Stamp the three days after Peak day or spotting." into field "problem"
  660.               return 0
  661.             end if
  662.           end if
  663.         end if
  664.         set x to x + 1
  665.         if x >= 4 then
  666.           if getAt(stamp, i) = 5 then
  667.             put "ERROR: " & "On Day # " & i & ", the Brown Baby Stamp was used.  If dry after Peak+3 days or more than three days after mucus or spotting, use the Brown Stamp." into field "problem"
  668.             return 0
  669.           else
  670.             put "ERROR: " & "On Day # " & i & ", the Yellow Baby Stamp was used.  If mucus is present after Peak+3 days or more than three days after spotting, use the Yellow Stamp or White Stamp." into field "problem"
  671.           end if
  672.           return 0
  673.         end if
  674.         next repeat
  675.       end if
  676.       set x to 0
  677.     end repeat
  678.     if not anyFertileDay() and (getOne(stamp, 4) > 0) then
  679.       put "ERROR: The Yellow Baby Stamp was used but there was no previous Peak type day." into field "problem"
  680.       return 0
  681.     end if
  682.   end if
  683.   return 1
  684. end
  685.